/*
 * @Author: WangZhiJie
 * @Date: 2024-03-26 13:52:53
 * @LastEditTime: 2024-04-01 14:30:54
 * @Description: 
 * @FilePath: \ga-smart-city-app-front\src\components\PageHeader\index.tsx
 */
import React from "react";
import "./index.less";
import goBackIcon from "../../images/icon/goback-icon.png";

type PageHeaderType = {
  leftBtn?:boolean;
  title: string;
  goback?: () => void;
  rightBtn?:React.ReactNode|string
};
/**
 * 
 * @param leftBtn 左边按钮的显隐控制 
 * @param title 标题 
 * @param rightBtn 右边显示的内容 
 * @returns 
 */
const PageHeader: React.FC<PageHeaderType> = ({ leftBtn=true,title,rightBtn }) => {
  return (
    <div className="page-header-contarnier">
      <div className="head_back"></div>
      <div className="head_box">
        {
          leftBtn?
          <div className="page-goback-icon">
            <img
              src={goBackIcon}
              alt=""
              onClick={() => {
                window.history.back();
              }}
            />
          </div>:<div></div>
        }
        <span className="page-header-title">{title}</span>
        <div className="right_box">
          {rightBtn?rightBtn:<div></div>}
        </div>
      </div>
    </div>
  );
};

export default PageHeader;
